﻿/************************************************************************
 * AIDE - Automata Identification Engine
 * Copyright (C) 2012-2013 Ali Khalili (khalili_DOT_ir_@SIGN_gmail_DOT_com)
 * **********************************************************************
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License (LGPL) published 
 * by the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version. This program is distributed without any
 * warranty. See the GNU Lesser General Public License for more details. 
 * ***********************************************************************
 * File         :     AIDE\Utils\ValuedList.cs
 * Description  :     A list with one extra value
 * Change log   :     -Dec 2012: initil version
 * To Do        :
 ************************************************************************/
using System;
using System.Collections.Generic;
using System.Collections;

namespace AIDE.Utils
{
    /// <summary>
    /// A list with additional value
    /// </summary>
    /// <typeparam name="T">type of list</typeparam>
    /// <typeparam name="VALUETYPE">type of additional value</typeparam>
    internal class ValuedList<T, VALUETYPE>
        : List<T>
    {
        public VALUETYPE value;

        public ValuedList(VALUETYPE value)
        {
            this.value = value;
        }

        public ValuedList()
        {
            /// nothing!
        }

        /// <summary>
        /// Here, we don't care about the value (it should be used by application). We just make two of them union
        /// </summary>
        /// <param name="lst"></param>
        public void Union(ValuedList<T, VALUETYPE> lst)
        {
            foreach (T t in lst)
            {
                /// we should use "equal" function, becuase we may want to add two node that has 
                /// equal ID but they belong two different machine!!!!!!!!
                //bool existsInList = false;
                //foreach (T tt in this)
                //{
                //    if ((T)tt == (T)t)
                //    {
                //        existsInList = true;
                //        break;
                //    }
                //}
                //if (!Contains(t))
                Add(t);
            }
        }
    }

    ///// <summary>
    ///// [To Do: Remove: Use ValuedList'bool instead]
    ///// A list which contains a boolean flag!
    ///// </summary>
    ///// <typeparam name="T">type of elements of the list</typeparam>
    //class FlaggedList<T> : List<T>
    //{
    //    public bool flag = true;

    //    public void Union(FlaggedList<T> lst)
    //    {
    //        foreach (T t in lst)
    //            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    //            if (!Contains(t))
    //                Add(t);
    //    }
    //}



    //static Word 	concat(Word myAccessString, ISymbol input)
    //          returns a copy of the original Word with one ISymbol attached
    //static Word 	concat(Word myAccessString, ISymbol s1, ISymbol s2)
    //          retuerns a copy of the original Word with two Symbols attached
    //static Word 	concat(Word myAccessString, Word w2)
    //          concatenates two words AND returns a corresponding NEW word
    //static Word 	flattenTrace(Word trace)
    //          Fold "virtual" letters (splitters) back to the normal alphabet
    //static boolean 	isPrefixOf(Word myAccessString, Word w2)
    //          Checks if the first given Word is a prefix of the second given Word
    //static ISymbol 	lastSymbol(Word w)
    //static Word 	prefix(Word myAccessString, int length)
    //static Word 	suffix(Word myAccessString, int length)
    //static Word 	toWord(ISymbol input)
    //          cast symbol to word
    //static ISymbol 	turnWordIntoSymbol(Word w)
    //          Turn word into a symbol, which has a list of the symbols of the input word as user object

    

}
